package com.zxl.yjb.adapter;

import android.support.annotation.Nullable;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zxl.yjb.R;
import com.zxl.yjb.bean.SkillClassifyBean;

import java.util.List;

public class SkillAdapter extends BaseQuickAdapter<SkillClassifyBean.SkillBean,BaseViewHolder> {

    private boolean isSelectMode;

    public SkillAdapter(int layoutResId, @Nullable List<SkillClassifyBean.SkillBean> data,boolean isSelectMode) {
        super(layoutResId, data);
        this.isSelectMode = isSelectMode;
    }


    @Override
    protected void convert(BaseViewHolder helper, SkillClassifyBean.SkillBean item) {
        helper.setText(R.id.tv_item_skill,item.getName());

        if ((item.isSelect()||item.getIsSkillReg() == 1)&&isSelectMode){
            ((TextView)helper.getView(R.id.tv_item_skill)).setTextColor(mContext.getResources().getColor(R.color.white_color));
            helper.getView(R.id.ll_skill_item_bg).setBackgroundColor(mContext.getResources().getColor(R.color.main_color));
        } else {
            ((TextView)helper.getView(R.id.tv_item_skill)).setTextColor(mContext.getResources().getColor(R.color.black_color));
            helper.getView(R.id.ll_skill_item_bg).setBackgroundColor(mContext.getResources().getColor(R.color.white_color));
        }


    }
}
